<template>
    <el-table :border=true :data="tableData" style="width: 75%">
        <el-table-column fixed prop="name" label="任务名称" width="200" />
        <el-table-column prop="note" label="描述" width="400" />
        <el-table-column fixed="right" label="操作" width="400">
            <template #default>
                <el-button link type="dedaul" size="large" @click="createClick">创建</el-button>
                <el-button link type="primary" size="large" @click="paueClick">暂停</el-button>
                <el-button link type="success" size="large" @click="resumClick">恢复</el-button>
                <el-button link type="info" size="large" @click="runOnceClick">只执行一次</el-button>
                <el-button link type="warning" size="large" @click="editClick">修改</el-button>
                <el-button link type="danger" size="large" @click="deleteClick">删除</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script>
import {jobClick} from '@/http/api'
import { ElMessage } from 'element-plus'

export default {
    name: 'CourseList',
    setup() {
        let tableData = [{
            note: '我的第一个定时任务',
            name: 'MyJob',
            action: '',
        }]
        let createClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.toString());
            })  

        }
        let paueClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.result.user_id.toString());
            })         
        }
        let resumClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.result.nickname);
            })         
        }
        let runOnceClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.result.nickname);
            })         
        }
        let deleteClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.result.nickname);
            })         
        }
        let editClick = () => {
            jobClick.then(res=>{
                console.log(res);
                ElMessage.success(res.result.nickname);
            })         
        }
        
        return {
            tableData,
            createClick,
            paueClick,
            resumClick,
            runOnceClick,
            deleteClick,
            editClick
        }

    }



}
</script>
